package link.hwx.controller.oa;

import com.alibaba.fastjson.JSONObject;
import link.hwx.entity.oa.WorkflowDetailTableInfoEntity;
import link.hwx.entity.oa.WorkflowRequestTableField;
import link.hwx.entity.oa.WorkflowRequestTableRecord;
import link.hwx.util.HttpManager;
import link.hwx.util.IdentityVerifyUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 流程创建实例
 * description :
 * author ：JHY
 * date : 2020/4/29
 * version : 1.0
 */
public class RequestCreateDemo {


    public static void main(String[] args) {
        RequestCreateDemo demo = new RequestCreateDemo();
        demo.createRequest("A5", "1"); //userid获取
    }


    /**
     * 创建流程入口
     * @param requestnamesuffix
     * @param userid
     */
    public void createRequest(String requestnamesuffix, String userid) {
        IdentityVerifyUtil identityVerifyUtil = IdentityVerifyUtil.getInstance();
        String spk = identityVerifyUtil.getSPK();
        String secret = identityVerifyUtil.getSECRET();
        String token = identityVerifyUtil.getToken();
        if (spk == null || secret == null || token == null) {
            return;
        }
        String requestResou = IdentityVerifyUtil.HOST +"/api/workflow/paService/getRequestOperatorInfo";
        String workflUrl = IdentityVerifyUtil.HOST +"/api/workflow/paService/getCreateWorkflowList";
        String url = IdentityVerifyUtil.HOST + "/api/workflow/paService/doCreateRequest";
        HttpManager http = new HttpManager();
        Map<String, String> heads =  IdentityVerifyUtil.getHttpHeads(token,userid,spk);
        Map<String, String> params = new HashMap<>();
       /* params.put("requestName", "请购单" + requestnamesuffix);
        params.put("mainData", getFormMainData());
        params.put("detailData",getFormDetailData());
        params.put("workflowId", "5");
        params.put("remark","请购单创建");*/

        params.put("requestid", "36037");
        try {
            http.cookieStore.clear();
            String res = http.postDataSSL(requestResou, params, heads);
            System.out.println(res);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * 主表数据
     *
     * 附件上传 包含base64, http等
     * 包含浏览框数据，单行文本数据
     * @return
     */
    private String getFormMainData(){
        List<WorkflowRequestTableField> mainData = new ArrayList<>();
       /* WorkflowRequestTableField field1 = new WorkflowRequestTableField();

        //附件上传字段
        field1.setFieldName("tpsc");
        List<Map<String,String>> fileInfo = new ArrayList<>();
        Map<String,String> fileItem1 = new HashMap<>();
        fileItem1.put("fileName","t01d0b9e7421ad092b5.jpg");
        String str1 = "base64:/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAGQAZADASIAAhEBAxEB/8QAGwABAAIDAQEAAAAAAAAAAAAAAAYHAQQFAwL/xAAZAQEBAQEBAQAAAAAAAAAAAAAAAgMBBAX/2gAMAwEAAhADEAAAAblAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMcZxW/bmpcLkAAAAAAAAAAAAAAAAAAAAABE5TSuenK2fDHl+1fXvFJX7PghQAAAAAAAAAAAAAAAAAAAAc3jmVH1uv5/XFE58c/qLLpG4/R8TcGuYAAAAAAAAAAAAAAAAAAAccqn+1Hsddj53ef3vxjY2uND1nug5L+xS1yaR6i5AAAAAAAAAAAAAAAAAAczpwiexSyuYipPxNvpXNCXXwZdFRaVcbs3EQ1ZtUsXbucZ0gOgAAAAAAAAAAAAAAAAFa2RVedT/ANPP4abtd+mfNrxMyzPh9vxJaruD6fz/ABrS2KlvO2fSlrPqe2LkAAAAAAAAAAAAAAAB4e8FnvBi/t5Y63X0+b0tsYjArr08tao+LQ2sdqxtnOfV5sVLbdbER6fPnWek5zjO2IdAAAAAAAAAAAAAAAOH3HFbRK6qRy0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exsl13L+IrPuwBCDOe3/wB2Jx56nBKjJmpfp8fMOMWfATqGvOw2c7MTM51/3Mx1JxP8RmYQrXExBc4BFjr/AMkI/eaLfuOXIjQUERFZ0qmPFO6Qn9w7+4oALD6USC+kr+IQLSrWICkgT+R6leVz0BArR2PWhsfDmf70dMavUZ61dPvRiD2XEGxLIRLcAfsgy6VYD9sSWhQsD9wU7NCewKxLr31cD5HmAwwUm3q67ficGIzlPY5gHMFGx68GdmJW00ufrTEIdeJ1Y8MiDQDofiL74elhdBAnmto8ML/uAdpVac9HzzGhWntlJ69RR8WIUuwOJeFXzCy6YbDrwnmuY3Ol/GhpemIafWXf+oO8ZaLXXfU5g7LZOUrmI1Ho436v+ZaDJSlh6fcJW5YLHywVDZjYeHG/OnMdnN+T9eDmcznTO3+PD9bCZ3MJe1hrnT62uy5ersvyG+49TqX4c/8AgHV3Hhztr8M87LmZnZiY21o6Z0zu41e9MeHG3MzozEM6nEYa4mJW25czP96Olzvw15M+PjYeKp14jraec68hrja7DzHixodT6jsIbM6ENOfBz5+d1amh1sO9MxlbjU7/ACsbcQ2OmdOtxK89eWp9znV0vxY2sr8BmN+dWY2EOp8TjVmdc7c63MeG+N2JjY9eJ628Q1xDXE+5mPWw8GdmdDrR2HWz72V86kJ9zMzOYTPiNfuV4PvZiY2Vv//Z";
        fileItem1.put("filePath",str1);
        fileInfo.add(fileItem1);

        Map<String,String> fileItem2 = new HashMap<>();
        fileItem2.put("fileName","scm_8802d1a86_4.png");
        fileItem2.put("filePath","http://scm.ddimg.mobi/scm_8802d1a86_4.png");
        //fileInfo.add(fileItem2);

        field1.setFieldValue(JSONObject.toJSONString(fileInfo));
        mainData.add(field1);*/
        //申请日期
        WorkflowRequestTableField sqrq = new WorkflowRequestTableField();
        sqrq.setFieldName("sqrq");
        sqrq.setFieldValue("2022-07-06");
        mainData.add(sqrq);
        //申请人
        WorkflowRequestTableField sqr = new WorkflowRequestTableField();
        sqr.setFieldName("sqr");
        sqr.setFieldValue("1");
//        mainData.add();
        //申请部门
        WorkflowRequestTableField sqbm = new WorkflowRequestTableField();
        sqbm.setFieldName("sqbm");
        sqbm.setFieldValue("");
//        mainData.add();
        //单据日期
        WorkflowRequestTableField createOn = new WorkflowRequestTableField();
        createOn.setFieldName("CreatedOn");
        createOn.setFieldValue("2022-07-06");
        mainData.add(createOn);
        //公司
        WorkflowRequestTableField gs = new WorkflowRequestTableField();
        gs.setFieldName("gs");
        gs.setFieldValue("001");
        //单据类型
        WorkflowRequestTableField prDocType = new WorkflowRequestTableField();
        prDocType.setFieldName("PRDocType");
        prDocType.setFieldValue("1002206240021688");
        mainData.add(prDocType);

        //核算币种
        WorkflowRequestTableField ac = new WorkflowRequestTableField();
        ac.setFieldName("AC");
        ac.setFieldValue("1");
        mainData.add(ac);

        //需求人员
        WorkflowRequestTableField reqEmploye = new WorkflowRequestTableField();
        reqEmploye.setFieldName("ReqEmployee");
        reqEmploye.setFieldValue("1002206280222909");

        //需求部门
        WorkflowRequestTableField reqOrg = new WorkflowRequestTableField();
        reqOrg.setFieldName("ReqDepartment");
        reqOrg.setFieldValue("1002206070011800");

        //备注
        WorkflowRequestTableField memo = new WorkflowRequestTableField();
        memo.setFieldName("Memo");
        memo.setFieldValue("备注");
        mainData.add(memo);
        return JSONObject.toJSONString(mainData);
    }

    /**
     * 明细数据
     * @return
     */
    private String getFormDetailData(){
        List<WorkflowDetailTableInfoEntity> details = new ArrayList<>();

        //明细信息
        WorkflowDetailTableInfoEntity detail1 = new WorkflowDetailTableInfoEntity();
        detail1.setTableDBName("formtable_main_18");

        //明细数据
        List<WorkflowRequestTableRecord> detailRows = new ArrayList<WorkflowRequestTableRecord>();
        WorkflowRequestTableRecord row1 = new WorkflowRequestTableRecord();

        //明细行数据
        List<WorkflowRequestTableField> rowDatas = new ArrayList<>();

        //行字段数据
        //料号
        WorkflowRequestTableField itemCode = new WorkflowRequestTableField();
        itemCode.setFieldName("ItemInfo_Itemcode");
        itemCode.setFieldValue("101010002");
        rowDatas.add(itemCode);
        //需求数量
        WorkflowRequestTableField reqQtyTU = new WorkflowRequestTableField();
        reqQtyTU.setFieldName("ReqQtyTU");
        reqQtyTU.setFieldValue("12");
        rowDatas.add(reqQtyTU);
        //要求交货日期
        WorkflowRequestTableField requiredDeliveryDate = new WorkflowRequestTableField();
        requiredDeliveryDate.setFieldName("RequiredDeliveryDate");
        requiredDeliveryDate.setFieldValue("2022-07-07");
        rowDatas.add(requiredDeliveryDate);
        //需求人员
        WorkflowRequestTableField reqEmployee = new WorkflowRequestTableField();
        reqEmployee.setFieldName("ReqEmployee");
        reqEmployee.setFieldValue("1002206280222909");
        rowDatas.add(reqEmployee);
        //需求部门
        WorkflowRequestTableField reqDept = new WorkflowRequestTableField();
        reqDept.setFieldName("ReqDept");
        reqDept.setFieldValue("1002206070011800");
        rowDatas.add(reqDept);
        //备注
        WorkflowRequestTableField memo = new WorkflowRequestTableField();
        memo.setFieldName("Memo");
        memo.setFieldValue("备注");
        rowDatas.add(memo);

        row1.setRecordOrder(0);
        row1.setWorkflowRequestTableFields(rowDatas);
        detailRows.add(row1);

        detail1.setWorkflowRequestTableRecords(detailRows);
        details.add(detail1);
        return JSONObject.toJSONString(details);

    }

}
